/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package neo.workforce.dao.impl;

import java.util.List;
import neo.workforce.dao.CommonDAO;
import neo.workforce.dao.Condition;
import neo.workforce.dao.ConditionDAO;
import org.apache.log4j.Logger;

/**
 *
 * @author krisada
 */
public class ConditionDAOImpl extends CommonDAO implements ConditionDAO {
    private static final long serialVersionUID = 8134167889329372618L;
    
    private Logger log = Logger.getLogger(this.getClass());

    public Condition find(long id) {
        return (Condition)super.find(Condition.class, id);
    }

    public Long save(Condition condition) {
        return super.save(condition);
    }

    public boolean update(Condition condition) {
        return super.update(condition);
    }

    public boolean remove(long id) {
        return super.remove(Condition.class, id);
    }

    public List findAll(long actionId) {
        StringBuilder buf = new StringBuilder();
        buf.append("FROM neo.workforce.dao.Condition o WHERE o.action.id = ").append(actionId).append(" desc o.createDate");
        log.info(buf.toString());
        java.util.List ls = getHibernateTemplate().find(buf.toString());
        return ls;
    }
    
}
